package com.acegear.horizon.domain.events;

import com.acegear.horizon.domain.models.jpa.AGDailyFeed;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by guoweike on 17/3/9.
 */
public class AGDailyModifiedEvent extends BaseEvent {

  private Long dailyId;

  private Long date;

  private String background;

  private boolean state;

  private List<AGDailyItem> agDailyItemArrayList;

  public AGDailyModifiedEvent(Long dailyId, Long date, String background, boolean state,
                              List<AGDailyItem> agDailyItemArrayList) {
    this.dailyId = dailyId;
    this.date = date;
    this.background = background;
    this.state = state;
    this.agDailyItemArrayList = agDailyItemArrayList;
    genEventId();
  }

  public AGDailyModifiedEvent() {
  }

  public Long getDailyId() {
    return dailyId;
  }

  public void setDailyId(Long dailyId) {
    this.dailyId = dailyId;
  }

  public Long getDate() {
    return date;
  }

  public void setDate(Long date) {
    this.date = date;
  }

  public String getBackground() {
    return background;
  }

  public void setBackground(String background) {
    this.background = background;
  }

  public boolean isState() {
    return state;
  }

  public void setState(boolean state) {
    this.state = state;
  }

  public List<AGDailyFeed> getAgDailyItemArrayList() {
    List<AGDailyFeed> agDailyFeeds = new ArrayList<>();
    agDailyItemArrayList.forEach((aGDailyItem ->
        agDailyFeeds.add(new AGDailyFeed(aGDailyItem.getItemId(), aGDailyItem.getItemType(),
            aGDailyItem.getPosition()))
    ));
    return agDailyFeeds;
  }


  public void setAgDailyItemArrayList(List<AGDailyItem> agDailyItemArrayList) {
    this.agDailyItemArrayList = agDailyItemArrayList;
  }

  @Override
  public String routingKey() {
    return "horizon.domain.aGDaily.update";
  }

}
